# def jia(a,b):
#     return a+b
# def ys(jia):
#     result=jia(12,14)
#     return result
# print(ys(jia))
# print(ys(lambda x,y:x-y))

# f=open("测试.txt","r",encoding="UTF-8")
# for line in f:
#     print(line)
# context=f.read()
# print(context)

# f=open("测试.txt","a",encoding="UTF-8")
# f.write("我是插班生\n嘿嘿")
# f.flush()
# p=open("测试.txt","r",encoding="UTF-8")
# for line in p:
#     print(line,end='')


# f=open("blll.txt","r",encoding="utf-8")
# p=open("bill.txt.bak","w",encoding="utf-8")
# for line in f :
#     line=line.strip()#去除末尾换行
#     if line.__contains__("正式"):
#         p.write(line+"\n")
# f.close()
# p.close()

# try:
#     f=open("abc.txt","r")
# except:
#     f=open("abc.txt","w")

# from pyecharts.charts import Line
#
# line = Line()
# line.add_xaxis(["中国", "美国", "日本"])
# line.add_yaxis("GDP", [30, 20, 18])
# line.render()


# from pyecharts.charts import Map
# from pyecharts.options import *
# map=Map()
# data=[
#     ("北京",35),
#     ("南京",26),
#     ("上海",68),
#     ("广东",690)
# ]
# map.add("title",data,"china")
# map.set_global_opts(
#     toolbox_opts=ToolboxOpts(
#         is_show=True
#     ),
#     visualmap_opts=VisualMapOpts(
#         is_show=True
#
#
#     )
# )
# map.render("map.html")

from pyecharts.charts import Bar,Timeline
from pyecharts.options import LabelOpts
from pyecharts.globals import ThemeType

bar1 =Bar()
bar1.add_xaxis(["中国","美国","英国"])
bar1.add_yaxis("三国GDP",[34,25,2],label_opts=LabelOpts(position="right"))
bar1.reversal_axis()
bar2 =Bar()
bar2.add_xaxis(["中国","美国","英国"])
bar2.add_yaxis("三国GDP",[54,45,20],label_opts=LabelOpts(position="right"))
bar2.reversal_axis()
bar3 =Bar()
bar3.add_xaxis(["中国","美国","英国"])
bar3.add_yaxis("三国GDP",[234,125,62],label_opts=LabelOpts(position="right"))
bar3.reversal_axis()
bar4 =Bar()
bar4.add_xaxis(["中国","美国","英国"])
bar4.add_yaxis("三国GDP",[434,225,222],label_opts=LabelOpts(position="right"))
bar4.reversal_axis()

timeline=Timeline({
    "theme":ThemeType.ROMANTIC
})
timeline.add(bar1,"1")
timeline.add(bar2,"2")
timeline.add(bar3,"3")
timeline.add(bar4,"4")

timeline.add_schema(
    play_interval=1000,
    is_timeline_show=True,
    is_auto_play=True,
    is_loop_play=True

)
timeline.render("GDP2.html")